﻿<%@ Page Language="C#" AutoEventWireup="true" EnableViewState="false" CodeFile="VehicleMonitor.aspx.cs" Inherits="VehicleMonitor" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>
        <%=this.GetLocalResource("SystemName")%></title>
    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
    <link href="css/Public.css" rel="stylesheet" type="text/css" />

    <script type="text/javascript" src="js/JQuery/jquery-1.3.2.min.js"></script>

    <link href="css/jquery.Treeview.css" rel="stylesheet" type="text/css" />

    <script src="js/JQuery/jquery.treeview.js" type="text/javascript"></script>

    <script src="js/Public.js" type="text/javascript"></script>

    <style type="text/css">
        body
        {
            margin: 0 0 0 0;
        }
        td
        {
            font-size: 9pt;
            font-family: Arial;
            vertical-align: middle;
            color: White;
        }
        /*页头*/.top_title
        {
            border-bottom: solid 2px #cccccc;
            height: 35px;
            background-color: #666666;
        }
        /*车辆列表表头*/#tdTop
        {
            font-size: 9pt;
            font-family: 微软雅黑;
            vertical-align: middle;
            background-color: #f5f5f5;
            color: Black;
            border-bottom: 1px solid #cccccc;
        }
        #tdTop td
        {
            color: Black;
        }
        #tdVehicle td, a
        {
            color: Black;
        }
        /*下拉菜单*/.menu_table
        {
            height: 35px;
            margin-right: 5px;
            margin-left: auto;
        }
        .menu_table div
        {
            margin-left: 8px;
            margin-right: 8px;
            padding-right: 16px;
            color: White;
            border-right: solid 1px white;
            cursor: pointer;
        }
        .menu_table_td
        {
            height: 35px;
        }
        .menu_body
        {
            margin-top: 10px;
            margin-right: auto;
            position: absolute;
            width: 220px;
        }
        .td_menu
        {
            cursor: pointer;
            border-bottom: 1px solid #ffffff;
            color: white;
            background-color: #444849;
            text-align : center;
            vertical-align: middle;
            height: 20px;
            filter: Alpha(opacity=80);
            -moz-opacity: 0.8;
            opacity: 0.8;
        }
        .td_menu_hover
        {
            cursor: pointer;
            border-bottom: 1px solid #ffffff;
            color: blue;
            background-color: #deedf7;
            text-align: center;
            vertical-align: middle;
            height: 20px;
        }
        /*最小化按钮*/.img_min
        {
            border: none;
        }
        .img_min_hover
        {
            border: outset 1px #cccccc;
        }
        /*最小化后的车辆列表*/#tdHide
        {
            width: 20px;
            background-color: #f5f5f5;
            border-right: 2px solid #cccccc;
            color: Black;
            vertical-align: top;
            text-align: left;
            writing-mode: tb-rl;
        }
        /*车辆状态*/#tdInfo
        {
            border-top: outset 2px #cccccc;
            height: 50px;
            background-color: #444444;
        }
        #tdStatus td
        {
            color: Black;
        }
        #tdStatus a
        {
            color: Blue;
        }
        .table_status td
        {
            padding-left: 5px;
            text-align: left;
            color: White;
            font-size: 9pt;
            font-family: Arial;
        }
        .table_status td span
        {
            margin-left: 3px;
            font-weight: bold;
            color: #fff00a;
            font-size: 9pt;
            font-family: Arial;
        }
        /*右键菜单*/#divContextMenu
        {
            width: 200px;
            background-color: #666666;
            position: absolute;
            z-index: 100;
            border: solid 1px #cccccc;
        }
        .ContextMenu td
        {
            height: 20px;
            text-align: center;
            border-bottom: inset 1px #ffffff;
            color: white;
            cursor: pointer;
        }
        .ContextMenu_hover
        {
            background-color: #f5f5f5;
            background-image: url(images/BuddyMenu.ico);
            background-repeat: no-repeat;
            background-position: 2px 3px;
        }
        /*车辆资料显示*/.tableVehInfo
        {
            background-color: #f5f5f5;
            border: double 3px #666666;
        }
        .tableVehInfo td
        {
            padding: 3px 3px 3px 3px;
            color: Black;
        }
        /*闪烁图标样式*/.imgShine
        {
            border: none;
            vertical-align: middle;
        }
        .spanTrack
        {
            margin-left: 3px;
            color: Blue;
            font-weight: bold;
        }
        #dgvVehicles td
        {
            padding: 0 0 0 0;
            font-size: 8pt;
            background-color: White;
            text-align: left;
            vertical-align: middle;
            padding-left: 2px;
            padding-right: 2px;
        }
        #divList1 th
        {
            background-color: White;
            text-align: center;
            vertical-align: middle;
            padding-left: 2px;
            padding-right: 2px;
            color: #666666;
        }
    </style>
</head>
<body style="overflow: hidden;" scroll="no">
    <form id="form1" runat="server">
    <div id="divLoading" style="text-align: center;">
        <div style="background-color: #f5f5f5; width: 340px; margin: auto; margin-top: 200px;
            border: solid 1px #666666; padding: 15px 15px 15px 15px; text-align: center;">
            <img style="vertical-align: middle; margin-right: 5px;" src="images/nbLoading.gif" /><b
                style="font-size: 10pt; font-family: 微软雅黑; color: Blue;"><%=this.GetLocalResource("Loading")%>...</b>
        </div>
    </div>
    <div id="divContent" style="display: none;">

        <script type="text/javascript">
    function ShowDropMenu(id)
    {
        $("#"+id).css("display","");
        document.getElementById(id).parentNode.childNodes[0].style.color="#fff00a";
    }
    function HideDropMenu(id)
    {
        $("#"+id).css("display","none");
        document.getElementById(id).parentNode.childNodes[0].style.color="white";
    }
        </script>

        <div>
            <table cellpadding="0" cellspacing="0" id="tableTotal">
                <tr>
                    <td class="top_title">
                        <table cellpadding="0" cellspacing="0" style="width: 100%;">
                            <tr>
                                <td style="width: 35%;">
                                    <img src="Images/icon.bmp" alt="" style="vertical-align: middle; margin-left: 3px;
                                        margin-right: 3px;" /><%=this.GetLocalResource("CurrentUser")%>:<span style="color: #fff00a;"><%=GetNiceName() %></span><span
                                            style="margin-left: 25px;"><%=this.GetLocalResource("LoginName")%>:</span><span style="color: #fff00a;"><%=DateTime.Now.ToString("HH:mm:ss")%></span>
                                </td>
                                <td style="width: 65%; text-align: right; overflow: hidden;">
                                    <table cellpadding="0" cellspacing="0" class="menu_table" id="tableMenu" style="display:none;">
                                        <tr>
                                            <td class="menu_table_td" onmouseover="ShowDropMenu('menu1')" onmouseout="HideDropMenu('menu1')">
                                                <div>
                                                    <%=this.GetLocalResource("MechinaSet")%></div>
                                                <table cellpadding="0" cellspacing="0" id="menu1" class="menu_body" style="display: none;margin-left: -80px!important;*margin-left: -160px!important;">
                                                    <%if (HavePer("btnItem3_3"))
                                                      { %>
                                                    <tr>
                                                        <td class="td_menu" onclick='<%="ShowIframe(\"6F\",0,\"SignalRef/PeripheralSetting.aspx\",640,\""+this.GetLocalResource("PeripheralSetting")+"\",true)" %>'>
                                                            <%=this.GetLocalResource("PeripheralSetting")%>
                                                        </td>
                                                    </tr>
                                                    <%} %>
                                                    <%if (HavePer("btnItem3_4"))
                                                      { %>
                                                    <tr>
                                                        <td class="td_menu" onclick='<%="ShowIframe(\"70\",0,\"SignalRef/MileSet.aspx\",300,\""+this.GetLocalResource("MileSet")+"\",true)" %>'>
                                                            <%=this.GetLocalResource("MileSet")%>
                                                        </td>
                                                    </tr>
                                                    <%} %>
                                                    <%if (HavePer("btnItem3_5"))
                                                      { %>
                                                    <tr>
                                                        <td class="td_menu" onclick='<%="ShowIframe(\"64\",0,\"SignalRef/IntervalSet.aspx\",320,\""+this.GetLocalResource("IntervalSet")+"\",true)" %>'>
                                                            <%=this.GetLocalResource("IntervalSet")%>
                                                        </td>
                                                    </tr>
                                                    <%} %>
                                                    <%if (HavePer("btnItem3_19"))
                                                      { %>
                                                    <tr>
                                                        <td class="td_menu" onclick='<%="ShowIframe(\"7F\",0,\"SignalRef/SetTimeArea.aspx\",300,\""+this.GetLocalResource("TimeZone")+"\",true)" %>'>
                                                            <%=this.GetLocalResource("TimeZone")%>
                                                        </td>
                                                    </tr>
                                                    <%} %>
                                                    <%if (HavePer("btnItem3_6"))
                                                      { %>
                                                    <tr>
                                                        <td class="td_menu" onclick='<%="ShowIframe(\"69\",0,\"SignalRef/OverSpeedSet.aspx\",380,\""+this.GetLocalResource("OverSpeedSet")+"\",true)" %>'>
                                                            <%=this.GetLocalResource("OverSpeedSet")%>
                                                        </td>
                                                    </tr>
                                                    <%} %>
                                                    <%if (HavePer("btnItem3_7"))
                                                      { %>
                                                    <tr>
                                                        <td class="td_menu" onclick='<%="ShowIframe(\"68\",0,\"SignalRef/StopSet.aspx\",380,\""+this.GetLocalResource("StopSet")+"\",true)" %>'>
                                                            <%=this.GetLocalResource("StopSet")%>
                                                        </td>
                                                    </tr>
                                                    <%} %>
                                                    <%if (HavePer("btnItem3_8"))
                                                      { %>
                                                    <tr>
                                                        <td class="td_menu" onclick='<%="ShowIframe(\"6D\",0,\"SignalRef/DriveSet.aspx\",380,\""+this.GetLocalResource("DriveSet")+"\",true)" %>'>
                                                            <%=this.GetLocalResource("DriveSet")%>
                                                        </td>
                                                    </tr>
                                                    <%} %>
                                                    <%if (HavePer("btnItem3_10"))
                                                      { %>
                                                    <tr>
                                                        <td class="td_menu" onclick='<%="ShowIframe(\"6B\",0,\"SignalRef/OilSet.aspx\",380,\""+this.GetLocalResource("OilSet")+"\",true)" %>'>
                                                            <%=this.GetLocalResource("OilSet")%>
                                                        </td>
                                                    </tr>
                                                    <%} %>
                                                    <%if (HavePer("btnItem4_11"))
                                                      { %>
                                                    <tr>
                                                        <td class="td_menu" onclick='<%="ShowIframe(\"80#81\",0,\"SignalRef/IntervalPhoto.aspx\",400,\""+this.GetLocalResource("AutoPhoto")+"\",true)" %>'>
                                                            <%=this.GetLocalResource("AutoPhoto")%>
                                                        </td>
                                                    </tr>
                                                    <%} %>
                                                    <%if (HavePer("btnItem3_9"))
                                                      { %>
                                                    <tr>
                                                        <td class="td_menu" onclick='<%="ShowIframe(\"72\",0,\"SignalRef/MsgNoSet.aspx\",300,\""+this.GetLocalResource("MsgNoSet")+"\",true)" %>'>
                                                            <%=this.GetLocalResource("MsgNoSet")%>
                                                        </td>
                                                    </tr>
                                                    <%} %>
                                                    <tr>
                                                        <td class="td_menu" onclick='<%="ShowIframe(\"84\",0,\"SignalRef/LedControl.aspx\",500,\""+this.GetLocalResource("LedControl")+"\",true)" %>'>
                                                            <%=this.GetLocalResource("LedControl")%>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td class="td_menu" onclick='<%="ShowIframe(\"85\",0,\"SignalRef/TempAlarmSetting.aspx\",380,\""+this.GetLocalResource("TemperatureSet")+"\",true)" %>'>
                                                            <%=this.GetLocalResource("TemperatureSet")%>
                                                        </td>
                                                    </tr>
                                                    <%if (Session["VehicleLogin"] == null)
                                                      { %>
                                                    <tr>
                                                        <td class="td_menu" onclick="window.open('NetUI/SetArea.aspx')">
                                                            <%=this.GetLocalResource("AreaSet") %>
                                                        </td>
                                                    </tr>
                                                    <%} %>
                                                </table>
                                            </td>
                                            <td class="menu_table_td" onmouseover="ShowDropMenu('menu2')" onmouseout="HideDropMenu('menu2')">
                                                <div>
                                                    <%=this.GetLocalResource("DataSearchStati")%></div>
                                                <table cellpadding="0" cellspacing="0" id="menu2" class="menu_body" style="display: none;margin-left: -60px!important;*margin-left: -160px!important;">
                                                    <%if (HavePer("btnItem2_1"))
                                                      { %>
                                                    <tr>
                                                        <td class="td_menu" onclick='window.open("NetUI/StreamSearch.aspx")'>
                                                            <%=this.GetLocalResource("StreamSearch")%>
                                                        </td>
                                                    </tr>
                                                    <%} %>
                                                    <tr>
                                                        <td class="td_menu" onclick='window.open("NetUI/OperationSearch.aspx")'>
                                                            <%=this.GetLocalResource("OperationSearch")%>
                                                        </td>
                                                    </tr>
                                                    <%if (HavePer("btnItem2_11"))
                                                      { %>
                                                    <tr>
                                                        <td class="td_menu" onclick='window.open("NetUI/ImageQuery.aspx")'>
                                                            <%=this.GetLocalResource("ImageQuery")%>
                                                        </td>
                                                    </tr>
                                                    <%} %>
                                                    <%if (HavePer("btnItem2_3"))
                                                      { %>
                                                    <tr>
                                                        <td class="td_menu" onclick='window.open("NetUI/PlayBack.aspx?id="+GetSystemNos())'>
                                                            <%=this.GetLocalResource("PlayBack")%>
                                                        </td>
                                                    </tr>
                                                    <%} %>
                                                    <%if (HavePer("btnItem5_1"))
                                                      { %>
                                                    <tr>
                                                        <td class="td_menu" onclick='window.open("Report/VehicleAlarm.aspx")'>
                                                            <%=this.GetLocalResource("VehicleAlarm")%>
                                                        </td>
                                                    </tr>
                                                    <%} %>
                                                    <%if (HavePer("btnItem5_11"))
                                                      { %>
                                                    <tr>
                                                        <td class="td_menu" onclick='window.open("Report/AlarmStati.aspx")'>
                                                            <%=this.GetLocalResource("AlarmCountStati")%>
                                                        </td>
                                                    </tr>
                                                    <%} %>
                                                    <%if (HavePer("btnItem5_2"))
                                                      { %>
                                                    <tr>
                                                        <td class="td_menu" onclick='window.open("Report/TravelRecord.aspx")'>
                                                            <%=this.GetLocalResource("TravelRecord")%>
                                                        </td>
                                                    </tr>
                                                    <%} %>
                                                    <%if (HavePer("btnItem5_3"))
                                                      { %>
                                                    <tr>
                                                        <td class="td_menu" onclick='window.open("Report/MileAnalysis.aspx")'>
                                                            <%=this.GetLocalResource("MileAnalysis")%>
                                                        </td>
                                                    </tr>
                                                    <%} %>
                                                    <%if (HavePer("btnItem5_4"))
                                                      { %>
                                                    <tr>
                                                        <td class="td_menu" onclick='window.open("Report/OilSpeedChart.aspx")'>
                                                            <%=this.GetLocalResource("UseOilStati")%>
                                                        </td>
                                                    </tr>
                                                    <%} %>
                                                    <%if (HavePer("btnItem5_14"))
                                                      { %>
                                                    <tr>
                                                        <td class="td_menu" onclick='window.open("Report/TripStati.aspx")'>
                                                            <%=this.GetLocalResource("TripStati")%>
                                                        </td>
                                                    </tr>
                                                    <%} %>
                                                    <%if (HavePer("btnItem5_15"))
                                                      { %>
                                                    <tr>
                                                        <td class="td_menu" onclick='window.open("Report/ParkingStati.aspx")'>
                                                            <%=this.GetLocalResource("ParkingStati")%>
                                                        </td>
                                                    </tr>
                                                    <%} %>
                                                    <%if (HavePer("btnItem5_17"))
                                                      { %>
                                                    <tr>
                                                        <td class="td_menu" onclick='window.open("Report/ScrollStati.aspx")'>
                                                            <%=this.GetLocalResource("ScrollStati")%>
                                                        </td>
                                                    </tr>
                                                    <%} %>
                                                    <%if (HavePer("btnItem5_18"))
                                                      { %>
                                                    <tr>
                                                        <td class="td_menu" onclick='window.open("Report/TemperatureChart.aspx")'>
                                                            <%=this.GetLocalResource("TemperatureChart")%>
                                                        </td>
                                                    </tr>
                                                    <%} %>
                                                    <tr>
                                                        <td class="td_menu" onclick='window.open("Report/StatusReport.aspx")'>
                                                            <%=this.GetLocalResource("StatusReport")%>
                                                        </td>
                                                    </tr>
                                                    <%if (HavePer("btnItem5_10"))
                                                      { %>
                                                    <tr>
                                                        <td class="td_menu" onclick='window.open("Report/AreaStati.aspx")'>
                                                            <%=this.GetLocalResource("AreaSrhReport")%>
                                                        </td>
                                                    </tr>
                                                    <%} %>
                                                    <%if (HavePer("btnItem5_16"))
                                                      { %>
                                                    <tr>
                                                        <td class="td_menu" onclick='window.open("Report/AreaTripStati.aspx")'>
                                                            <%=this.GetLocalResource("OTripReport")%>
                                                        </td>
                                                    </tr>
                                                    <%} %>
                                                    <%if (HavePer("btnItem5_12"))
                                                      { %>
                                                    <tr>
                                                        <td class="td_menu" onclick='window.open("Report/TAreaTripStati.aspx")'>
                                                            <%=this.GetLocalResource("TTripReport")%>
                                                        </td>
                                                    </tr>
                                                    <%} %>
                                                    <%if (Common.GetAppConfigValue("IsForeign") == "1")
                                                      {%>
                                                    <%if (HavePer("btnItem5_18"))
                                                      { %>
                                                    <tr>
                                                        <td class="td_menu" onclick='window.open("Report/SgpDayTrip.aspx")'>
                                                            <%=this.GetLocalResource("VehTripReport")%>
                                                        </td>
                                                    </tr>
                                                    <%} %>
                                                    <%if (HavePer("btnItem5_19"))
                                                      { %>
                                                    <tr>
                                                        <td class="td_menu" onclick='window.open("Report/RunningTrip.aspx")'>
                                                            <%=this.GetLocalResource("RunTripReport")%>
                                                        </td>
                                                    </tr>
                                                    <%} %>
                                                    <%if (HavePer("btnItem5_20"))
                                                      { %>
                                                    <tr>
                                                        <td class="td_menu" onclick='window.open("Report/IdlingReprt.aspx")'>
                                                            <%=this.GetLocalResource("IdlingReport")%>
                                                        </td>
                                                    </tr>
                                                    <%} %>
                                                    <%} %>
                                                    <%if (HavePer("btnItem5_21"))
                                                      { %>
                                                    <tr>
                                                        <td class="td_menu" onclick='window.open("Report/TemperatureAlarm.aspx")'>
                                                            <%=this.GetLocalResource("TemperatureReport")%>
                                                        </td>
                                                    </tr>
                                                    <%} %>
                                                </table>
                                            </td>
                                            <td class="menu_table_td" onmouseover="ShowDropMenu('menu3')" onmouseout="HideDropMenu('menu3')">
                                                <div>
                                                    <%=this.GetLocalResource("PersonalSet")%></div>
                                                <table cellpadding="0" cellspacing="0" id="menu3" class="menu_body" style="margin-left: -40px!important;*margin-left: -160px!important;height: 42px;
                                                    display: none;">
                                                    <%if (Session["VehicleLogin"] == null)
                                                      { %>
                                                    <tr>
                                                        <td class="td_menu" onclick='<%=Session["VehicleLogin"]==null?"ShowInfo(\"NetUI/MyInfo.aspx\",\"550\",\"80\",\""+this.GetLocalResource("MyInfo")+"\")":"" %>'>
                                                            <%=this.GetLocalResource("MyInfo")%>
                                                        </td>
                                                    </tr>
                                                    <%} %>
                                                    <tr>
                                                        <td class="td_menu" onclick="ShowInfo('NetUI/ModifyPwd.aspx','430','80','<%=this.GetLocalResource("ModifyPwd")%>')">
                                                            <%=this.GetLocalResource("ModifyPwd")%>
                                                        </td>
                                                    </tr>
                                                </table>
                                            </td>
                                            <%if (HavePer("btnItem4_8"))
                                              { %>
                                            <td class="menu_table_td">
                                                <div onclick='window.open("NetUI/TrackManage.aspx?id="+GetSystemNos())'>
                                                    <%=this.GetLocalResource("MutipTrack")%></div>
                                            </td>
                                            <%} %>
                                            <td class="menu_table_td">
                                                <div onclick="DispLock('1')">
                                                    <%=this.GetLocalResource("LockApplication")%></div>
                                            </td>
                                            <td class="menu_table_td" style="border: none;">
                                                <div style="border: none;" onclick="VehicleMonitor.Logout();window.location.href='Login.aspx?LanguageType=<%=Session["LanguageType"]==null?"":Session["LanguageType"].ToString() %>';">
                                                    <%=this.GetLocalResource("Exit")%></div>
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                        </table>
                        <table cellpadding="0" id="tableLeft" cellspacing="0" style="position: absolute;
                            top: 37px; left: 0; width: 300px; border-right: solid 2px #cccccc;">
                            <tr>
                                <td id="tdTop" style="height: 30px; text-align: right;">
                                    <table cellpadding="0" cellspacing="0" style="width: 100%;">
                                        <tr>
                                            <td style="text-align: left; width: auto;">
                                                <a href="javascript:SetDisplay()" style="margin-left: 2px;">
                                                    <img src="images/TreeList.png" style="border: none; vertical-align: middle;" /><%=this.GetLocalResource("SwitchList") %></a><a
                                                        href="javascript:SetCMsgWindow('divAlarm','tdAlarm','')" id="tdAlarm" style="margin-left: 8px;"><span><img
                                                            src="Images/VehicleList/Alarm.png" class="imgShine" /><img src="Images/VehicleList/Alarm0.png"
                                                                class="imgShine" style="display: none;" /></span><%=this.GetLocalResource("Alarm") %></a><a
                                                                    href="javascript:SetCMsgWindow('divMessage','tdMsg','')" id="tdMsg" style="margin-left: 8px;"><span><img
                                                                        src="Images/VehicleList/Message.png" class="imgShine" /><img src="Images/VehicleList/Message0.png"
                                                                            class="imgShine" style="display: none;" /></span><%=this.GetLocalResource("Message") %></a>
                                            </td>
                                            <td style="text-align: center; width: auto;">
                                                <img src="images/min.ico" id="imgMin" style="cursor: hand; vertical-align: middle;"
                                                    onclick="DspVehList('none')" alt='<%=this.GetLocalResource("MixSize") %>' /><img
                                                        src="images/max.ico" id="imgMax" style="display: none; cursor: hand; vertical-align: middle;"
                                                        onclick="DspVehList('')" alt='<%=this.GetLocalResource("ShowVehList") %>' />
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                            <tr id="trVehL4">
                                <td id="tdSearch" style="height: 30px; background-color: #f5f5f5; border-bottom: 1px solid #cccccc;
                                    text-align: center; vertical-align: middle;">
                                    <select style="font-size: 9pt; width: 75px;" id="ddlMotorcade">
                                    </select>
                                    <select style="width: 75px; font-size: 9pt;" id="ddlType">
                                        <option value="1">
                                            <%=this.GetLocalResource("VehNoF")%></option>
                                        <option value="0">
                                            <%=this.GetLocalResource("SystemNo")%></option>
                                    </select>
                                    <input type="text" id="tbVehNoF" style="width: 80px;" onkeyup="KeyUpHandler(event)" />
                                    <input type="button" value="" onclick="SearchVehicle()" style="cursor: hand; background-image: url(images/botton.gif);
                                        background-repeat: no-repeat; background-color: Transparent; width: 33px; height: 24px;
                                        border: none;" />

                                    <script type="text/javascript">
                                        function KeyUpHandler(event)
                                        {
                                            if(event.keyCode==13)
                                                SearchVehicle();
                                        }
                                        //搜索符合条件的车队
                                        function SearchVehicle()
                                        {
                                            var ddlMc=document.getElementById("ddlMotorcade");
                                            var McID=ddlMc.selectedIndex>0?ddlMc.options[ddlMc.selectedIndex].value:"";
                                            
                                            var type=document.getElementById("ddlType").selectedIndex;
                                            
                                            var VehNoF=(type==0?document.getElementById("tbVehNoF").value.replace(/\s+/g,""):"");
                                            var SystemNo=(type==1?document.getElementById("tbVehNoF").value.replace(/\s+/g,""):"");
                                            
                                            //设置表格列表为可见
                                            document.getElementById("hdList").value="0";
                                            SetDisplay();
                                            //筛选不符合条件的行
                                            var trs=document.getElementById("dgvVehicles").getElementsByTagName("tr");
                                            var tras=document.getElementById("dgvVehicles").getElementsByTagName("textarea");
                                            for(var i=0;i<tras.length;i++)
                                            {
                                                var args=tras[i].innerHTML.split('|');  
                                                if(McID!=""&&args[1]!=McID)
                                                {                                                                           
                                                    trs[i].style.display="none";
                                                    continue;
                                                }
                                                if(SystemNo!=""&&args[2].indexOf(SystemNo)==-1)
                                                {                                                                            
                                                    trs[i].style.display="none";
                                                    continue;
                                                }
                                                if(VehNoF!=""&&args[3].indexOf(VehNoF)==-1)
                                                {                                                                           
                                                    trs[i].style.display="none";
                                                    continue;
                                                }                                            
                                                trs[i].style.display="";
                                            }
                                        }
                                        
                                        function ChangeList(flag)
                                        {
                                            if(flag==0)//显示所有车辆
                                                $("#dgvVehicles tr").css("display","");
                                            else
                                            {
                                                var sns=document.getElementById("hdVehJson").value.split('|')[0].split(',');                                              
                                                for(var i=0;i<sns.length;i++)
                                                {
                                                    var span=document.getElementById("span"+sns[i]);
                                                    var tr=$(span).parent().parent();
                                                    var color=$(span).css("color");
                                                    if(flag==1)//显示在线车辆
                                                        $(tr).css("display",((color!=""&&color!="black")&&color.toString()!="rgb(0, 0, 0)"?"":"none"));
                                                    else if(flag==2)//显示离线车辆
                                                        $(tr).css("display",(color=="black"||color.toString()=="rgb(0, 0, 0)"?"":"none"));
                                                }
                                            }
                                            var hdList=document.getElementById("hdList");
                                            document.getElementById("divList0").style.display="none";
                                            document.getElementById("divList1").style.display="";
                                            hdList.value=0;
                                        }
                                    </script>

                                </td>
                            </tr>
                            <tr id="trVehL1">
                                <td id="tdVehicle" style="background-color: White;">
                                    <div id="divVehLoading" style="margin-top: 30px; text-align: center; color: Black;">
                                        <img src="images/loadh.gif" style="vertical-align: middle; margin-right: 5px;" alt="" /><span id="spanLoading"><%=this.GetLocalResource("LoadingVehList")%></span></div>
                                    <div style="display: none; overflow: auto; vertical-align: top; padding-top: 0;"
                                        class="divScroll" id="divVehicleList">
                                        <div id="divList0" style="padding-top: 0;">
                                            <ul id="tvVehicleList" style="color: Black;">
                                            </ul>
                                        </div>
                                        <div id="divList1">
                                            <table cellpadding="2" cellspacing="1" style="width:410px;background-color: #cccccc;">
                                                <thead>
                                                    <tr>
                                                        <th style="width: 20px;">
                                                        </th>
                                                        <th style="width: 110px;">
                                                            <%=this.GetLocalResource("VehNoFt")%>
                                                        </th>
                                                        <th style="width: 120px;">
                                                            <%=this.GetLocalResource("Timet")%>
                                                        </th>
                                                        <th style="width: 70px;">
                                                            <%=this.GetLocalResource("Speedt")%>(Km/h)
                                                        </th>
                                                        <th style="width: 90px;">
                                                            <%=this.GetLocalResource("Milet")%>(Km)
                                                        </th>
                                                    </tr>
                                                </thead>
                                                <tbody id="dgvVehicles">
                                                </tbody>
                                            </table>
                                        </div>
                                    </div>
                                    <input type="hidden" id="hdList" value='<%=Common.GetAppConfigValue("GridType") %>' />
                                    <!--记录要显示的列表类型：0树形列表，1网格列表-->
                                    <script type="text/javascript">
                                    function SetDisplay()
                                    {
                                        var hdList=document.getElementById("hdList");
                                        document.getElementById("divList0").style.display=(hdList.value=="0"?"":"none");
                                        document.getElementById("divList1").style.display=(hdList.value=="1"?"":"none");
                                        hdList.value=1-parseInt(hdList.value);
                                    }
                                    SetDisplay();
                                    </script>
                                </td>
                            </tr>
                            <tr id="trVehL5">
                                <td style="height: 25px; border-top: 1px solid #cccccc; background-color: #f5f5f5;
                                    color: Black; text-align: left;">
                                    <%=this.GetLocalResource("NetStatus")%><a id="aStatus" style="font-size: 8pt;"><font
                                        color="blue"><%=this.GetLocalResource("Connecting")%>...</font></a>
                                    <input type="checkbox" id="chbDrawLine" style="vertical-align: middle; margin-left: 5px;" /><%=this.GetLocalResource("DrawLine")%>
                                    <a style="margin-left: 5px; color: Blue; text-decoration: underline;" href="javascript:StartLoad()">
                                        <%=this.GetLocalResource("Refresh")%></a>
                                </td>
                            </tr>
                            <tr id="trVehL3">
                                <td id="tdStatus" style="height: 25px; border-top: 1px solid #cccccc; background-color: #f5f5f5;
                                    color: Black; text-align: center;">
                                    <table cellpadding="0" cellspacing="0" border="0" style="width: 100%; height: 25px;">
                                        <tr>
                                            <td align="center" valign="middle" style="width: 33%">
                                                <a title='<%=this.GetLocalResource("ShowAll")%>' style="color: Black; text-decoration:underline;" href="javascript:ChangeList(0)">
                                                    <%=this.GetLocalResource("TotalNum")%></a><a id="aTotalVehicles"></a>
                                            </td>
                                            <td align="center" valign="middle" style="width: 33%">
                                                <a title='<%=this.GetLocalResource("ShowOnline")%>' style="color: Black; text-decoration:underline;" href="javascript:ChangeList(1)">
                                                    <%=this.GetLocalResource("OnLineNum")%></a><a id="aOnLine">0</a>
                                            </td>
                                            <td align="center" valign="middle" style="width: 33%">
                                                <a title='<%=this.GetLocalResource("ShowOffline")%>' style="color: Black; text-decoration:underline;" href="javascript:ChangeList(2)">
                                                    <%=this.GetLocalResource("OffLineNum")%></a><a id="aOffLine"></a>
                                            </td>
                                        </tr>
                                    </table>
                                    <asp:HiddenField runat="server" ID="hdAreaAlarm" />
                                    <input type="hidden" id="hdOnLine" value='<%=Common.GetAppConfigValue("OnLineTime") %>' />
                                    <script type="text/javascript"> 
                                    
                                var AaVehicles="|";//设置了区域报警的车辆的SystemNo
                                var AreaAlarms=$("#hdAreaAlarm").val();//区域报警设置
                                if(AreaAlarms!="")
                                    AreaAlarms=eval('('+AreaAlarms+')');

                                var aOnLine=$("#aOnLine");
                                var aOffLine=$("#aOffLine");
                                var elements=[];
                                var sys=null;
                                //获取在线时间设置
                                var munites=$("#hdOnLine").val();
                                
                                //颜色值依次表示：离线，在线且停车中，在线且行使中
                                var colors=new Array("black","#20b2aa","blue","yellow","red"); 
                                //处理简易位置数据
                                function Process90(msg)
                                {
                                    //处理区域报警
                                    if(AreaAlarms!="")
                                        ShowAreaAlarm(msg);
                                    
                            
                                    //之前从未上来定位数据或为离线
                                    var asimid="a"+msg.SimID;
                                    if(!elements[asimid])
                                        elements[asimid]=$("#"+asimid);
                                    obj=elements[asimid];
                                    
                                    var dgasimid="dga"+msg.SimID;
                                    if(!elements[dgasimid])
                                        elements[dgasimid]=$("#"+dgasimid);
                                    objg=elements[dgasimid];
                                    
                                    if($(obj).attr("title")==""||$(obj).parent().css("color")==colors[0])                                                                    
                                    {
                                        $(aOnLine).text(parseInt($(aOnLine).text())+1);
                                        $(aOffLine).text(parseInt($(aOffLine).text())-1);
                                        
                                        //更新公司和车队的在线车辆数目                                                                            
                                        var args=$(obj).attr("dataFld").split(',');
                                        
                                        var acompany="a"+args[0];
                                        if(!elements[acompany])
                                            elements[acompany]=$("#"+acompany);
                                        $(elements[acompany]).text(parseInt($(elements[acompany]).text())+1);
                                        
                                        var amotorcade="a"+args[1];
                                        if(!elements[amotorcade])
                                            elements[amotorcade]=$("#"+amotorcade);
                                        $(elements[amotorcade]).text(parseInt($(elements[amotorcade]).text())+1);
                                    }
                                    
                                    //更新网格列表中的相关项
                                    var amilesimid="aMile"+msg.SimID;
                                    if(!elements[amilesimid])
                                        elements[amilesimid]=$("#"+amilesimid);
                                    $(elements[amilesimid]).text((parseFloat(msg.Miles)/1000-parseFloat($(elements[amilesimid]).attr("title"))).toFixed(3));
                                    
                                    var aspeedsimid="aSpeed"+msg.SimID;
                                    if(!elements[aspeedsimid])
                                        elements[aspeedsimid]=$("#"+aspeedsimid);
                                    $(elements[aspeedsimid]).text(msg.Velocity);
                                    
                                    var atimesimid="aTime"+msg.SimID.toString();
                                    if(!elements[atimesimid])
                                        elements[atimesimid]=$("#"+atimesimid);
                                    $(elements[atimesimid]).text(msg.DateTime);
                                    
                                    //更新颜色
                                    if(parseInt(msg.Velocity)>2)
                                    {
                                        $(obj).parent().css("color",colors[2]);
                                        $(objg).parent().css("color",colors[2]);
                                    }
                                    else
                                    {
                                        $(obj).parent().css("color",colors[1]);
                                        $(objg).parent().css("color",colors[1]);
                                    }
                                    //不定位
                                    if(msg.LocateStatus=="NoLocate")
                                    {
                                        $(obj).parent().css("color",colors[3]);
                                        $(objg).parent().css("color",colors[3]);
                                    }
                                        
                                    //更新最新位置数据上传时间
                                    $(obj).attr("title",msg.DateTime);
                                    $(objg).attr("title",msg.DateTime);
                                }
                                
                                //在线情况检测
                                function CheckOnLine(prefix,UpdateAll)
                                {try{
                                    if(sys==null)
                                    {
                                        sys=GetSystemNos(true);
                                        sys=sys.split(',');
                                    }
                                    
                                    for(var i=0;i<sys.length;i++)
                                    {
                                        var obj=document.getElementById(prefix+sys[i]);
                                        var FromTime=obj.title;
                                        //之前此车辆从未上传过定位数据，或已离线
                                        if(FromTime==""||$(obj).parent().css("color")==colors[0])
                                            continue;
                                        
                                        FromTime=new Date(FromTime.replace(/-/g,"/"));
                                        var ToTime=new Date();
                                        //离线处理
                                        if((ToTime-FromTime)/1000/60>=munites)
                                        {
                                            if(UpdateAll)
                                            {
                                                //更新公司和车队的在线车辆数目
                                                var args=$(obj).attr("dataFld").split(',');
                                                aCompany=document.getElementById("a"+args[0]);
                                                aMotorCade=document.getElementById("a"+args[1]);
                                                $(aCompany).text(parseInt($(aCompany).text())-1);
                                                $(aMotorCade).text(parseInt($(aMotorCade).text())-1);
                                                
                                                //更新总在线和离线车辆数目
                                                $(aOnLine).text(parseInt($(aOnLine).text())-1);
                                                $(aOffLine).text(parseInt($(aOffLine).text())+1);
                                            }
                                            
                                            $(obj).parent().css("color",colors[0]);
                                        }
                                    }}catch(e){}
                                }
                                
                                function Point(lng,lat)
                                {
                                    this.Longitude=parseFloat(lng);
                                    this.Latitude=parseFloat(lat);
                                }                                                                    
                                
                                //显示区域报警信息
                                function ShowAreaAlarm(msg)
                                {
                                    if(AaVehicles=="|")
                                    {
                                        for(var i=0;i<AreaAlarms.AlarmSet.length;i++)
                                        {
                                            AaVehicles+=AreaAlarms.AlarmSet[i].SystemNo+"|";
                                        }
                                    }
                                    //是否设置了区域报警
                                    if(AaVehicles.indexOf("|"+msg.SimID+"|")==-1)
                                        return;
                                    var length=AreaAlarms.AlarmSet.length;
                                    //获取报警区域
                                    for(var i=0;i<length;i++)
                                    {
                                        if(msg.SimID==AreaAlarms.AlarmSet[i].SystemNo)
                                        {                                                                            
                                            var pnt=new Point(msg.Longitude,msg.Latitude);
                                            var pntlist=[];
                                            var strs=AreaAlarms.AlarmSet[i].StrPoints.split('|');
                                            var VehNoF=AreaAlarms.AlarmSet[i].VehNoF;
                                            var Flag=AreaAlarms.AlarmSet[i].Flag;
                                            if(!(Flag=="1"||Flag=="2"))
                                                continue;
                                            var FeatureName=AreaAlarms.AlarmSet[i].FeatureName;
                                            
                                            //获取区域边界点
                                            for(var j=0;j<strs.length;j++)
                                            {
                                                var lnglat=strs[j].split(',');
                                                pntlist[j]=new Point(lnglat[0],lnglat[1]);
                                            }
                                            
                                            var flg=PointInPolygon(pnt,pntlist);
                                            
                                            //入界和越界报警(每次越界和入界只报一次)
                                            if(AreaAlarms.AlarmSet[i].LastStatus!=Flag
                                                &&((Flag=="1"&&!flg)||(Flag=="2"&&flg)))
                                            {
                                                var msg="{\"SimID\":\""+msg.SimID+"\",\"SignalType\":\"Alarm\",\"Longitude\":\""+msg.Longitude
                                                    +"\",\"Latitude\":\""+msg.Latitude+"\",\"Time\":\""+msg.DateTime+"\",\"ResultMsg\":\""+GetAlarmMsg(VehNoF,Flag,FeatureName)
                                                    +"\",\"AlarmLocation\":\"\"}";//alert(msg);
                                                AlarmProcess(eval('('+msg+')'));
                                            }
                                            
                                            //记录车辆当前状态是界内1还是界外2
                                            AreaAlarms.AlarmSet[i].LastStatus=(flg?"2":"1");
                                        }
                                    }                                                                            
                                    
                                }
                                
                                //构造报警信息
                                function GetAlarmMsg(VehNoF,Flag,FeatureName)
                                {
                                    var msg=VehNoF;
                                    switch(Flag)
                                    {
                                        case "1":
                                            msg+=' <%=this.GetLocalResource("OutArea") %>';
                                            break;
                                        case "2":
                                            msg+=' <%=this.GetLocalResource("IntoArea") %>';
                                            break;
                                        default:
                                            break;
                                    }
                                    return msg+"("+FeatureName+")";
                                }
                                //判断是在区域内
                                function PointInPolygon(pnt,pntlist)
                                {
                                    if (pntlist == null)
                                    {
                                        return false;
                                    }
                                    var j = 0, cnt = 0;var str="";
                                    for (var i = 0; i < pntlist.length; i++)
                                    {
                                        j = (i == pntlist.length - 1) ? 0 : j + 1;
                                        if ((pntlist[i].Latitude != pntlist[j].Latitude) 
                                            && (
                                                ((pnt.Latitude >= pntlist[i].Latitude) && (pnt.Latitude < pntlist[j].Latitude)) 
                                                || ((pnt.Latitude >= pntlist[j].Latitude) && (pnt.Latitude < pntlist[i].Latitude))
                                            ) && (pnt.Longitude < (pntlist[j].Longitude - pntlist[i].Longitude) * (pnt.Latitude - pntlist[i].Latitude) / (pntlist[j].Latitude - pntlist[i].Latitude) + pntlist[i].Longitude)) cnt++;
                                    }
                                    return (cnt % 2 > 0) ? true : false;
                                }
                                                                    
                                    </script>
                                </td>
                            </tr>
                            <tr id="trVehL2">
                                <td style="height: 25px; border-top: 1px solid #cccccc; background-color: #f5f5f5;
                                    color: Black; text-align: left;">
                                    <table cellpadding="0" cellspacing="0" style="width: 300px; height: 25px;">
                                        <tr>
                                            <td style="width: auto; color: Black; text-align: right;">
                                                <%=this.GetLocalResource("ConstantMsg") %>:
                                            </td>
                                            <td style="width: 202px; border-left: solid 1px #cccccc; border-right: 1px solid #cccccc;">
                                                <input type="text" id="tbIM" style="border: none; width: 200px; vertical-align: middle;
                                                    background-color: #ffffff; color: blue;" />
                                            </td>
                                            <td style="width: 25px;" onmouseover="this.style.backgroundColor='#f5f5f5'" onmouseover="this.style.backgroundColor='white'">
                                                <img src="images/window_ico.gif" alt='<%=this.GetLocalResource("Details") %>' onclick="SetCMsgWindow('divCMessage','','')"
                                                    style="border: none; vertical-align: middle; cursor: hand; text-align: center;" />
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td id="tdMap" style="text-align:right;">
                        <iframe src="NetUI/GoogleMap.aspx" id="ifrContent" name="ifrContent" style="width: 100%;
                            height: 100%; overflow: hidden; border: none;" frameborder="0" marginheight="0"
                            marginwidth="0"></iframe>
                    </td>
                </tr>
                <tr>
                    <td id="tdInfo">
                        <table cellpadding="0" cellspacing="0" style="height: 50px; width: 100%;" class="table_status">
                            <tr>
                                <td style="width: 13%;">
                                    <%=this.GetLocalResource("VehNoF")%>:<span id="spanVehNoF"></span>
                                </td>
                                <td style="width: 12%">
                                    <%=this.GetLocalResource("SystemNo")%>:<span id="spanSystemNo"></span>
                                </td>
                                <td style="width: 13%">
                                    <%=this.GetLocalResource("Time")%><span id="spanTime"></span>
                                </td>
                                <td style="width: 10%">
                                    <%=this.GetLocalResource("LocateStatus")%><span id="spanLocate"></span>
                                </td>
                                <td style="width: 7%">
                                    <%=this.GetLocalResource("ACC")%><span id="spanAcc"></span>
                                </td>
                                <td style="width: 8%">
                                    <%=this.GetLocalResource("Speed")%><span id="spanSpeed"></span>Km/h
                                </td>
                                <td style="width: 12%">
                                    <%=this.GetLocalResource("Oil")%><span id="spanOil"></span>L<span id="spanOM"></span>
                                </td>
                                <td style="width: 12%">
                                    <%=this.GetLocalResource("Mile")%><span id="spanMile"></span>Km
                                </td>
                                <td style="width: 13%">
                                    <%=this.GetLocalResource("DayMile")%><span id="spanDayMile" title="0">0</span>Km
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <%=this.GetLocalResource("LevelValue")%>:<span id="spanVoltage"></span>V
                                </td>
                                <td>
                                    <%=this.GetLocalResource("Temperature") %>:<span id="spanTemperature"></span>℃
                                </td>
                                <td>
                                    <label id="lblStatusA" title='<%=this.GetLocalResource("Status")%> A'>
                                        <%=this.GetLocalResource("Status")%>
                                        A</label>:<span id="spanStatusA"></span>
                                </td>
                                <td>
                                    <label id="lblStatusB" title='<%=this.GetLocalResource("Status")%> B'>
                                        <%=this.GetLocalResource("Status")%>
                                        B</label>:<span id="spanStatusB"></span>
                                </td>
                                <td>
                                    <label id="lblStatusC" title='<%=this.GetLocalResource("Status")%> C'>
                                        <%=this.GetLocalResource("Status")%>
                                        C</label>:<span id="spanStatusC"></span>
                                </td>
                                <td>
                                    <label id="lblStatusD" title='<%=this.GetLocalResource("Status")%> D'>
                                        <%=this.GetLocalResource("Status")%>
                                        D</label>:<span id="spanStatusD"></span>
                                </td>
                                <td colspan="3">
                                    <%=this.GetLocalResource("Address")%><span id="spanAddress"></span>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>
        </div>
        <table cellpadding="0" cellspacing="0" style="height: 197px; display: none;" width="290">
            <tr>
                <td style="width: 17px;">
                    <img src="images/bg-sub-menu_left.png" style="border: none;" alt="" />
                </td>
                <td style="width: 254px; background-image: url(images/bg-sub-menu.png)">
                </td>
                <td style="width: 17px;">
                    <img src="images/bg-sub-menu_right.png" style="border: none;" alt="" />
                </td>
            </tr>
        </table>
        <div style="visibility: hidden;" id="divContextMenu">
            <!--当前操作的车辆系统编号-->
            <input type="hidden" id="hdCSystemNo" />
            <table cellpadding="0" cellspacing="0" style="width: 100%;" class="ContextMenu">
                <tr>
                    <td onclick="LocateVeh()">
                        <%=this.GetLocalResource("Locate") %>
                    </td>
                </tr>
                <tr>
                    <td onclick='SendSignal(60,null)'>
                        <%=this.GetLocalResource("Name")%>
                    </td>
                </tr>
                <%if (HavePer("btnItem2_6"))
                  { %>
                <tr>
                    <td onclick='SendSignal(66,null)'>
                        <%=this.GetLocalResource("GetVession")%>
                    </td>
                </tr>
                <%} %>
                <%if (HavePer("btnItem2_5"))
                  {%>
                <tr>
                    <td onclick='SendSignal(61,null)'>
                        <%=this.GetLocalResource("GetStatus")%>
                    </td>
                </tr>
                <%} %>
                <%if (HavePer("btnItem4_6"))
                  {%>
                <tr>
                    <td onclick='<%="ShowIframe(63,1,\"SignalRef/OilOperate.aspx\",300,\""+this.GetLocalResource("CutOil")+"\")" %>'>
                        <%=this.GetLocalResource("CutOil")%>
                    </td>
                </tr>
                <%} %>
                <%if (HavePer("btnItem4_7"))
                  {%>
                <tr>
                    <td onclick='<%="ShowIframe(63,0,\"SignalRef/OilOperate.aspx\",300,\""+this.GetLocalResource("ResetOil")+"\")" %>'>
                        <%=this.GetLocalResource("ResetOil")%>
                    </td>
                </tr>
                <%} %>
                <%if (HavePer("btnItem4_13"))
                  {%>
                <tr>
                    <td onclick="ShowIframe(63,0,'SignalRef/Photo.aspx',395,'<%=this.GetLocalResource("Photo")%>')">
                        <%=this.GetLocalResource("Photo")%>
                    </td>
                </tr>
                <%} %>
                <%if (HavePer("btnItem4_5"))
                  {%>
                <tr>
                    <td onclick='<%="ShowIframe(67,0,\"SignalRef/MornitorVoice.aspx\",300,\""+this.GetLocalResource("VoiceMonitor")+"\")" %>'>
                        <%=this.GetLocalResource("VoiceMonitor")%>
                    </td>
                </tr>
                <%} %>
                <%if (HavePer("btnItem4_3"))
                  {%>
                <tr>
                    <td onclick='<%="ShowIframe(65,0,\"SignalRef/ScheduleMsg.aspx\",400,\""+this.GetLocalResource("SendMsg")+"\")" %>'>
                        <%=this.GetLocalResource("SentMsg")%>
                    </td>
                </tr>
                <%} %>
                <%if (HavePer("btnItem2_3"))
                  {%>
                <tr>
                    <td onclick='window.open("NetUI/PlayBack.aspx?id="+$("#hdCSystemNo").val())'>
                        <%=this.GetLocalResource("PlayBack")%>
                    </td>
                </tr>
                <%} %>
            </table>
        </div>
        <!--遮盖DIV开始-->
        <div id="divDisable" class="Disabled" style='display: <%=hdIsLock.Value=="1"?"":"none"%>;'>
        </div>
        <!--遮盖DIV结束-->
        <div id="divLoadVeh" style="z-index: 1001; display: none; border: double 3px #666666;
            background-color: White; text-align: center; position: absolute; width: 340px;
            top: 200px; padding: 15px 15px 15px 15px;">
            <b style="font-size: 9pt; font-family: 微软雅黑;">
                <%=this.GetLocalResource("LoadLocation") %><span id="spanProgress" style="color: Blue;"></span>...<input
                    type="button" value='<%=this.GetLocalResource("skip") %>' onclick="SkipLoad()"
                    class="button" style="margin-left: 15px;" /></b>
        </div>
        <!--短信息-->
        <div id="divMessage" style="z-index: 1001; display: none; border: double 3px #666666;
            position: absolute; width: 680px; top: 70px;">
            <iframe src="Message/Message.aspx" id="ifrMessage" name="ifrMessage" frameborder="0"
                marginheight="0" marginwidth="0" scrolling="no" width="680px" height="460px">
            </iframe>
        </div>
        <!--即时消息-->
        <div id="divCMessage" style="z-index: 1001; display: none; border: double 3px #666666;
            position: absolute; width: 696px; top: 100px;">
            <iframe src="Message/CMessage.aspx" id="ifrCMessage" name="ifrCMessage" frameborder="0"
                marginheight="0" marginwidth="0" scrolling="no" width="696px" height="410px">
            </iframe>
        </div>
        <!--报警信息-->
        <div id="divAlarm" style="z-index: 1001; display: none; border: double 3px #666666;
            position: absolute; width: 696px; top: 100px;">
            <iframe src="Message/Alarm.aspx" id="ifrAlarm" name="ifrAlarm" frameborder="0" marginheight="0"
                marginwidth="0" scrolling="no" width="696px" height="410px"></iframe>
        </div>
        <!--浮动窗体开始(用作需认证的指令发送)-->
        <input type="hidden" id="hdArguments" />
        <input type="hidden" id="hdSignalType" />
        <embed id="embedMsg" src="Sound/msg.wav" autostart="false" loop="false" style="display: none;"></embed>
        <embed id="embedAlarm" src="Sound/Alarm.wav" autostart="false" loop="true" style="display: none;"></embed>
        <script type="text/javascript">
        //显示下发指令的窗体
        function ShowIframe(SignalType,Arguments,url,width,title,ClearHd)
        {
            if(ClearHd)
                document.getElementById("hdCSystemNo").value="";
                
            if(!VehCountCheck())
                return;
            var ifr=document.getElementById("ifrFloat");
            ifr.src=url;
            document.getElementById("hdSignalType").value=SignalType;
            document.getElementById("hdArguments").value=Arguments;            
            document.getElementById("divDisable").style.display="";
            var divIfrm=document.getElementById("divIfrm");
            divIfrm.style.width=width+"px";
            divIfrm.style.top="100px";
            divIfrm.style.left=($(window).width()-width)/2+"px";
            divIfrm.style.display="";
            document.getElementById("tdTitle").innerHTML=title;
        }
        //验证操作车辆的数量是否大于1
        function VehCountCheck()
        { 
            var SystemNos=GetSystemNos();
            if(SystemNos.split(',').length>1)
            {
                alert('<%=this.GetLocalResource("MultipleForbidden")%>');
                return false;
            }  
            else if(SystemNos=="")
            {
                alert('<%=this.GetLocalResource("CheckSelectedVehicle")%>');
                return false;
            }             
            return true;                                               
        }
        function ShowInfo(url,width,top,title)
        {            
            var ifr=document.getElementById("ifrFloat");
            ifr.src=url;
            document.getElementById("divDisable").style.display="";
            var divIfrm=document.getElementById("divIfrm");
            divIfrm.style.width=width+"px";
            divIfrm.style.top=top+"px";
            divIfrm.style.left=(window.document.body.clientWidth-width)/2+"px";
            divIfrm.style.display="";
            document.getElementById("tdTitle").innerHTML=title;
        }
        function CloseWindow()
        {
            document.getElementById("divDisable").style.display="none";
            document.getElementById("divIfrm").style.display="none";
        }
        function CloseMsgWd(id)
        {
            CloseWindow();
            window.document.getElementById(id).style.display='none';
        }
        </script>
        <div id="divIfrm" style="z-index: 1001; top: 220px; position: absolute; display: none;
            width: 550px; border: double 3px #666666;">
            <div style="cursor: move;">
                <table cellpadding="0" cellspacing="0" style="width: 100%;" id="divTitle">
                    <tr>
                        <td style="height: 29px; background-image: url(images/VehicleList_title_bg.jpg);
                            background-position: top; border-bottom: outset 2px #ffffff;">
                            <table cellpadding="0" cellspacing="0" style="width: 100%;">
                                <tr>
                                    <td style="vertical-align: middle; width: 25px; text-align: center;">
                                        <img style="margin-left: 3px; margin-right: 3px; text-align: center;" src="images/window_ico.gif" />
                                    </td>
                                    <td style="text-align: left; color: #7B9EBD; font-weight: bold;" id="tdTitle">
                                    </td>
                                    <td style="text-align: right; padding-right: 5px;">
                                        <img src="images/close.ico" id="imgFormClose" style="cursor:pointer;" onclick="CloseWindow()"
                                            onmouseover="this.className='buttonSize'" onmouseout="this.className=''" />
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>
            </div>
            <iframe frameborder="0" width="100%" id="ifrFloat" name="ifrFloat" height="100px"
                src="SignalRef/PeripheralSetting.aspx" marginheight="0" marginwidth="0"></iframe>
        </div>
        <!--浮动窗体结束-->
        
        <!--系统锁定开始-->
        <script type="text/javascript">
        function DispLock(IsLock)
        {        
            document.getElementById("divDisable").style.display=IsLock=="1"?"":"none"; 
            document.getElementById("divLock").style.display=IsLock=="1"?"":"none"; 
            document.getElementById("hdIsLock").value=IsLock; 
            VehicleMonitor.LockOperate(IsLock); 
            if(IsLock=="1")                                                           
                document.getElementById("tbPwd").focus();       
        }    
        function UnLock()
        {
            var res=Number(VehicleMonitor.CheckPwd(document.getElementById("tbPwd").value).value);
            if(res==1)
            {    
                document.getElementById("tbPwd").value="";
                DispLock("0");
            }
            else if(res==0)
                alert('<%=this.GetLocalResource("PwdWrong")%>');
            else
            {
                alert('<%=this.GetLocalResource("LoginOverTime")%>');
                window.location.href="Login.aspx";
            }
        }
        </script>
        <asp:HiddenField ID="hdIsLock" runat="server" Value="0" />
        <div id="divLock" class="DoubleBorder" style='display: <%=hdIsLock.Value=="1"?"":"none"%>;
            position: absolute; z-index: 1001; width: 220px; height: 140px; background-image: url(images/ListMenu/DropMenu_bg.jpg);
            background-position: center middle;'>
            <div style="text-align: center; padding: 2px 2px 2px 2px;">
                <br />
                <%=this.GetLocalResource("PleaseUnLock")%><br />
                <br />
                <input type="password" id="tbPwd" class="input" /><br />
                <br />
                <input type="button" class="button" value='<%=this.GetLocalResource("UnLock")%>'
                    onclick="UnLock()" />
                <br />
            </div>
        </div>
        <!--系统锁定结束-->
        
        <!--显示车辆基本信息开始-->
        <table cellpadding="0" cellspacing="0" id="tableVehInfo" class="tableVehInfo" style="z-index: 1001;
            position: absolute; width: 360px; display: none;">
            <tr>
                <td style="width: 50%; text-align: left; color: #666666;">
                    <%=this.GetLocalResource("VehNoF")%>:<span id="tdVehNoF" style="color: Black;"></span>
                </td>
                <td style="width: 50%; text-align: left; color: #666666;">
                    <%=this.GetLocalResource("MotorCade")%>:<span id="tdMcName" style="color: Black;"></span>
                </td>
            </tr>
            <tr>
                <td style="text-align: left; color: #666666;">
                    <%=this.GetLocalResource("SystemNo")%>:<span id="tdSystemNo" style="color: Black;"></span>
                </td>
                <td style="text-align: left; color: #666666;">
                    <%=this.GetLocalResource("SimCard")%>:<span id="tdSimID" style="color: Black;"></span>
                </td>
            </tr>
            <tr>
                <td colspan="2" style="text-align: left; color: #666666;">
                    <%=this.GetLocalResource("BelongCorp")%>:<span id="tdCompany" style="color: Black;"></span>
                </td>
            </tr>
            <tr>
                <td colspan="2" style="text-align: left; color: #666666;">
                    <%=this.GetLocalResource("Contact")%>:<span id="tdContact" style="color: Black;"></span>
                </td>
            </tr>
            <tr>
                <td colspan="2" style="text-align: center; background-color: #444849; color: white;
                    border-top: 1px solid #cccccc;">
                    <%=this.GetLocalResource("RPrompt") %>
                </td>
            </tr>
        </table>
        <script type="text/javascript">
        var vehids=("tdVehNoF|tdMcName|tdSystemNo|tdSimID|tdCompany|tdContact").split('|');
        var t = document.getElementById("tableVehInfo");         
        function mousePos(e)
        { 
            var x,y; 
            var e = e||window.event; 
            return{x:e.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,y:e.clientY+document.body.scrollTop+document.documentElement.scrollTop}; 
        }
        function mousehover(e)
        {
        try{
            var mouse = mousePos(e);     
            t.style.left = mouse.x + 10 + 'px'; 
            t.style.top = mouse.y + 10 + 'px';
            for(var i=0;i<vehids.length;i++)
            {
                $("#"+vehids[i]).text("");
            } 
            var obj=document.all ? event.srcElement : e.target;
            var res = obj.getAttribute("tip");            
            res=eval("("+res+")");
            $("#tdVehNoF").text(res.VehNoF);
            $("#tdMcName").text(res.McName);
            $("#tdSystemNo").text(res.SystemNo);
            $("#tdSimID").text(res.SimID);
            if('<%=(Session["User"] as System.Data.DataTable).Rows[0]["Grade"].ToString().Trim() != "2" && Session["VehicleLogin"] == null?"1":"0" %>'=='1')
                $("#tdCompany").text(res.CompanyName);
            $("#tdContact").text(res.Contact);
            t.style.display = '';
            }catch(ex){}
        }
        function mouseout(e)
        {t.style.display = 'none'; }
        </script>
        <!--显示车辆基本信息开始-->
    </div>

    <script type="text/javascript">
        $(document).ready(function()
        {
            PageInit();
            document.getElementById("divContent").style.display="";
            document.getElementById("divLoading").style.display="none";
        });
        window.onresize=function(){
            PageInit(); 
            CheckMapSize();
        };
        //尺寸初始化
        function PageInit()
        {
            var twidth=$(window).width();
            var theight=$(window).height();
            var divDisable=$("#divDisable");
            $(divDisable).width(twidth);
            $(divDisable).height(theight);
            var divLoadVeh=document.getElementById("divLoadVeh");
            divLoadVeh.style.left=(twidth-divLoadVeh.style.width.replace("px",""))/2+"px";
            var divMessage=document.getElementById("divMessage");
            divMessage.style.left=(twidth-divMessage.style.width.replace("px",""))/2+"px";
            var divCMessage=document.getElementById("divCMessage");
            divCMessage.style.left=(twidth-divCMessage.style.width.replace("px",""))/2+"px";
            var divAlarm=document.getElementById("divAlarm");
            divAlarm.style.left=(twidth-divAlarm.style.width.replace("px",""))/2+"px";
            var divLock=document.getElementById("divLock");
            divLock.style.left=(twidth-divLock.style.width.replace("px",""))/2+"px";
            divLock.style.top=(theight-divLock.style.height.replace("px",""))/2+"px";
            var tableVehInfo=document.getElementById("tableVehInfo");
            tableVehInfo.style.left=(twidth-tableVehInfo.style.width.replace("px",""))/2+"px";
            
            
            $("#tableTotal").width(twidth);
            $("#tableTotal").height(theight);
            
            //$("#tdMap").width(twidth-302);
            $("#tdMap").height(theight-89);
            
            if(IsVehListShow)
            {  
                $("#tableLeft").height(theight-89);
                $("#tdVehicle").height(theight-89-143);
                $("#divVehicleList").height(theight-89-143);
                $("#divVehicleList").width(300);
                $("#ifrContent").css("width",twidth-302)
            }
            else
                $("#ifrContent").css("width",twidth)
            
            $("td.td_menu").mouseover(function(){this.className="td_menu_hover";});
            $("td.td_menu").mouseout(function(){this.className="td_menu";});
            
            $("td.menu_table_td div").mouseover(function(){this.style.color="#fff00a";});
            $("td.menu_table_td div").mouseout(function(){this.style.color="white";});   
            
            $("#divContextMenu td").mouseover(function(){this.className="ContextMenu_hover";this.style.color="blue"});
            $("#divContextMenu td").mouseout(function(){this.className="";this.style.color="white"});        
        }
        //界面变换后刷新地图
        function CheckMapSize()
        {
            var ifr=document.getElementById("ifrContent").contentWindow;
            ifr.MapResize.call(ifr); 
        }
        
        //显示所有即时消息、报警或短消息
        function SetCMsgWindow(id,td,disp)
        {
            $("#"+id).css("display",disp);
            $("#divDisable").css("display",disp);
            if(disp==""&&td!="")
                StopPrompt(td,td=="tdAlarm"?1:2);
        }
        //显示或隐藏车辆列表
        var IsVehListShow=true;
        function DspVehList(dis)
        {
            try{  
            IsVehListShow=(dis=="");
            
            $("#trVehL1").css("display",dis);
            $("#trVehL2").css("display",dis);
            $("#trVehL3").css("display",dis);
            $("#trVehL4").css("display",dis);
            $("#trVehL5").css("display",dis);
            
            $("#imgMin").css("display",dis);
            $("#imgMax").css("display",dis=="none"?"":"none");
            
            var theight=$(window).height();
            $("#tableLeft").height(dis=="none"?30:theight-89);
            
            if(dis=="")
            {
                $("#tdVehicle").height(theight-89-143);
                $("#divVehicleList").height(theight-89-143);
            }
            
            var twidth=$(window).width();
            $("#ifrContent").width(twidth-(dis=="none"?0:302));
            CheckMapSize();
            }
            catch(e){}
        }
        
    //右键菜单控制-----------------------------------------------------------
    var _Tmenu = 0; 
    var _Amenu = 0; 
    var _Menu  = "null"; 
    if(!document.all) 
        document.captureEvents(Event.MOUSEDOWN);
    document.onclick = _Hidden;  
    function _Hidden() 
    { 
        if(_Tmenu==0) 
            return; 
        document.getElementById(_Tmenu).style.visibility="hidden"; 
        _Tmenu=0; 
    } 

    document.oncontextmenu = function (e) 
    {
        _Hidden(); 
        var _Obj = document.all ? event.srcElement : e.target;
        if(!($(_Obj).attr("menu")))
            return false;
        $("#hdCSystemNo").val($(_Obj).attr("dataFld"));
        if(document.all) e = event; 
        _ShowMenu("divContextMenu", e); 
        return false;
    } 
    function _ShowMenu(Eid, event) 
    {
        _Menu = document.getElementById(Eid); 

        var _Left = event.clientX + document.body.scrollLeft; 
        var _Top = event.clientY + document.body.scrollTop; 
        var theight=$(window).height();
        if(_Top+260>=theight)
            _Top=theight-300;
        _Menu.style.left = _Left.toString() + 'px'; 
        _Menu.style.top = _Top.toString() + 'px'; 
        _Menu.style.visibility = 'visible'; 
        document.getElementById("tableVehInfo").style.display="none";
        _Tmenu = Eid; 
    } 

    function transfer(e)
    { 
        e=e||window.event;
        e.cancelBubble=true; 
    } 

    function no_context_menu(e)
    { 
        e=e||window.event; 
        e=e||window.event;
        e.cancelBubble=true; 
        return; 
    } 
    </script>

    <!--记录当前跟踪的车辆-->
    <input type="hidden" id="hdTrack" value="|" />
    <!--是否开启报警提示音:1开启，0关闭-->
    <input type="hidden" id="hdTone" value='1' />
    <!--记录所有当前用户的所有车辆的车牌号和SystemNo-->
    <input type="hidden" value="" id="hdVehJson" />
    <!--记录当前连接的ClientID-->
    <input type="hidden" value="-1" id="hdClientID" />
    <div id="xmlsocket">
        <!--// swf dedicated div, doesn't modify layout //-->
    </div>

    <script src="js/XMLSocket.js" type="text/javascript"></script>

    <script type="text/javascript">
                                                            
    //网络连接-------------------------------------------------------------
    var xmls = new XMLSocket();
    var flashPlayerVersion = xmls.getFlashPlayerVersion();
    var connected = false;//连接状态
    var element = null;//存储网络连接状态的元素
    var maintainer=null;
    var DataString="";//存储收到的字符串
    var IsProcessing=false;//是否正在执行接收数据的处理
    var ReCt=0;//重连次数
    var IP='<%=Common.GetAppConfigValue("ServerIP") %>';
    var Port='<%=Common.GetAppConfigValue("BrowsePort") %>';
    var step=1;
    var MapLoad=false;
    window.onload =StartLoad;
    function StartLoad()
    {
        step=1;
        document.getElementById("divVehLoading").style.display="";
        document.getElementById("divVehicleList").style.display="none";
        //获取树形列表
        VehicleMonitor.GetTreeHtml(LoadVehiclesBack);
    }
    function LoadVehiclesBack(response)
    {
        if(step==1)
        {
            $("#tvVehicleList").html(response.value); 
            $("#tvVehicleList").treeview({open:"open",persist: "location",collapsed: true,unique: false});   
            $("#FirstSpan").trigger("click")       
            step=2;
            //获取网格列表
            setTimeout(function(){VehicleMonitor.GetGridHtml(LoadVehiclesBack)},1000);
        }
        else if(step==2)
        {
            $("#dgvVehicles").html(response.value);
            step=3;
            //获取所有车牌号和系统编号
            VehicleMonitor.GetVehJson(LoadVehiclesBack)
        }
        else if(step==3)
        {
            document.getElementById("hdVehJson").value=response.value;
            step=4;
            //获取所有车队
            VehicleMonitor.GetMotorcadeInComp(LoadVehiclesBack);
        }
        else if(step==4)
        {
            var mcs=response.value;
            if(mcs)
            {
                mcs=mcs.split('|');
                var ddlMotorcade=document.getElementById("ddlMotorcade");
                ddlMotorcade.innerHTML="";
                var opt=document.createElement("option");
                opt.text='<%=this.GetLocalResource("MotorCade") %>';
                ddlMotorcade.options.add(opt);
                for(var i=0;i<mcs.length;i++)
                {
                    var obj=document.createElement("option");
                    var args=mcs[i].split(',');
                    obj.value=args[0];
                    obj.text=args[1];
                    ddlMotorcade.options.add(obj);
                }
            }
            step=5;
            VehicleMonitor.GetVehicleCount(LoadVehiclesBack);
        }
        else if(step==5)
        {
            $("#aTotalVehicles").text(response.value);
            $("#aOnLine").text("0");
            $("#aOffLine").text(response.value);
            document.getElementById("divVehLoading").style.display="none";
            document.getElementById("divVehicleList").style.display="";
            UnloadHandler();
            connected=false;
            elements=[];
            if(!MapLoad)
            {
                var ifr=document.getElementById("ifrContent").contentWindow;
                ifr.LoadAllVeh.call(ifr); 
                MapLoad=true;
            }
            ConnectServer();
            document.getElementById("tableMenu").style.display="";
        }
    }
    function ConnectServer() 
    {
        if(flashPlayerVersion < 6 && flashPlayerVersion !== 0)
        {
            if(confirm('<%=this.GetLocalResource("CheckFlashPlayer")%>'))
                window.location.href="FlashPlayer/install_flash_player_ax.exe";
        }
        else 
        {
            element = document.getElementById ? document.getElementById("aStatus") : document.all["aStatus"];
            xmls.init("xmlsocket");
            xmls.onClose = function() 
            {
                ReCt=0;
                element.innerHTML='<font color=blue><%=this.GetLocalResource("Connecting")%>...</font>';
                connected=false;
                xmls.connect(IP,Port);
            };
            xmls.onConnect = function(success) 
            {
                connected = success;
                
                //开始定时检测车辆在线情况
                if(success)
                {
                    ReCt=0;
                    element.innerHTML = '<font color=blue><%=this.GetLocalResource("Connected")%></font>';
                    
                    var munites=document.getElementById("hdOnLine").value;                                                                            
                    //分别检测树形列表和网格列表
                    setInterval("CheckOnLine('a',true);CheckOnLine('dga',false);",120*1000);						                                                
                }
                else
                {    
                    //重连持续一分钟
                    element.innerHTML='<font color=blue><%=this.GetLocalResource("Connecting")%>...</font>';
                    if(ReCt<5)
                    {    
                        setTimeout(function(){xmls.connect(IP,Port);},200);
                        ReCt++;
                    }
                    else
                    {    
                        element.innerHTML = '<font color=red><%=this.GetLocalResource("ConnectFail")%></font>'; 
                        if(confirm('<%=this.GetLocalResource("RefreshConfirm")%>'))
                            window.location.href=window.location.href;
                    }                  
                }
            };
            xmls.onData = function(src) 
            {
                if(src!="")
                {
                    DataString+=src.toString();
                    if(!IsProcessing)
                    {
                        IsProcessing=true;
                        ProcessEveryJson();
                        //Concurrent.Thread.create(function(){ProcessEveryJson();});
                    }
                }
            };
            xmls.onXML = function(src){};
        }		                                                	
        if(!connected)
        {
            setTimeout("xmls.connect('"+IP+"', "+Port+");",2000);
        }
    };
    
    //刷新或关闭页面后断开连接
    window.onunload=UnloadHandler;
    function UnloadHandler()
    {
        if(connected) 
            xmls.send("{\"ClientID\":\""+$("#hdClientID").val()+"\",\"KillMe\":\"1\"}");
        if(maintainer!=null)
            clearInterval(maintainer);
    }
    function SendContent(text)
    {
        xmls.send(text);
    }
    
    //车辆定位--------------------------------------------------------------------    
    //点击树形或网格列表车牌的车辆定位
    function ShowVehicleLocation(SystemNo)
    {
        if(document.getElementById("ifrContent")!=null)
        {
            var ifr=document.getElementById("ifrContent").contentWindow;
            ifr.LocateVehicle.call(ifr,SystemNo);
            
            var chbs=document.getElementById("divVehicleList").getElementsByTagName("input");
            for(var i=0;i<chbs.length;i++)
            {
                if(chbs[i].type=="checkbox"&&chbs[i].title==SystemNo)
                    chbs[i].checked=true;
                else
                    chbs[i].checked=false;
            }
        }
    }
    
    //右键菜单中的车辆定位
    function LocateVeh()
    {
        var no=$("#hdCSystemNo").val();
        ShowVehicleLocation(no);     
    }
    //加载车辆位置信息时的遮盖
    function SetLoadVehDsp(disp)
    {
        //document.getElementById("divDisable").style.display=disp;
        document.getElementById("divLoadVeh").style.display=disp;        
    }
    //停止加载所有车辆到地图
    function SkipLoad()
    {
        var ifr=document.getElementById("ifrContent").contentWindow;
        ifr.ExistLoad.call(ifr);
    }
    
    
    //通信数据处理-----------------------------------------------------------------------------
    var NoneAlarms=[];//区域内不报警设置，键名：系统编号，键值：区域边界点
    var nonealarm=document.getElementById("hdAreaAlarm").value;
    if(nonealarm)
    {
        nonealarm=eval("("+nonealarm+")");
        for(var i=0;i<nonealarm.AlarmSet.length;i++)
        {
            if(nonealarm.AlarmSet[i].Flag=="9")
            {
                var pntlist=[];
                var strs=nonealarm.AlarmSet[i].StrPoints.split('|');                
                //获取区域边界点
                for(var j=0;j<strs.length;j++)
                {
                    var lnglat=strs[j].split(',');
                    pntlist[j]=new Point(lnglat[0],lnglat[1]);
                }
                NoneAlarms[nonealarm.AlarmSet[i].SystemNo]=pntlist;
            }
        }
    }
    //是否在禁用报警的区域内
    function AlarmEnable(msg)
    {
        if(NoneAlarms[msg.SimID])
        {
            if(PointInPolygon(new Point(msg.Longitude,msg.Latitude),NoneAlarms[msg.SimID]))
                return false;
        }
        return true;
    }
    
    //处理每个JSON串
    function ProcessEveryJson()
    {
        var strs=DataString.split('#');
        var Length=strs.length;
        for(var index=0;index<Length;index++)
        {
            if(!strs[index])
                continue;
            try
            {
                var data=eval("("+strs[index]+")");
                DataString=DataString.replace(strs[index]+"#","");
                
                //收到客户编号
                if(data.ServerDist)
                {
                    $("#hdClientID").val(data.ClientID);

                    //发送当前用户所有下属车辆的SystemNo
                    allsysno="|"+GetSystemNos(true).replace(/,/g,"|")+"|";
                    ic=0;
                    SendAllSys(data.ClientID);
                    setTimeout(function(){xmls.send("{\"ClientID\":\""+data.ClientID+"\",\"LanguageType\":\""
                    +'<%=(Session["LanguageType"]==null||(Session["LanguageType"]!=null&&Session["LanguageType"].ToString()==""))?"zh-cn":Session["LanguageType"].ToString() %>'
                    +"\"}");},100);
                    //开始链路维持，每60秒一次
                    clearInterval(maintainer);
                    maintainer=setInterval("xmls.send('{\"ClientID\":\""+data.ClientID+"\",\"MaintainLink\":\"1\"}')",60000);					                                                           
                }                
                //收到车机数据，而且所有车辆的系统编号均已发送完毕		                                                                
                else if(data.SignalType)
                {
                    switch(data.SignalType)
                    {
                        //报警数据处理
                        case "Alarm":
                            if(AlarmEnable(data))
                                AlarmProcess(data); 
                            break;
                        //定位数据处理
                        case "Locate": 
                            if(data.LocateStatus!="Locate")
                            {    
                                var ToTime=new Date();
                                data.DateTime=ToTime.getFullYear()+"-"+(ToTime.getMonth()+1)+"-"+ToTime.getDate()
                                        +" "+ToTime.getHours()+":"+ToTime.getMinutes()+":"+ToTime.getSeconds();
                            }
                            Process90(data);
                            var ifr=document.getElementById("ifrContent").contentWindow;
                            ifr.ShowNewPosition.call(ifr,data); 
                            break;
                        //收到车机短信
                        case "92":
                            var ifr=document.getElementById("ifrMessage").contentWindow;
                            ifr.AddMsg.call(ifr,data); 
                            //短消息框
                            if(document.getElementById("divMessage").style.display=="none")                                                      
                                StartPrompt('tdMsg',2);
                            else
                                StopPrompt('tdMsg',2);
                            break;
                        //拍照完毕
                        case "0C":
                            var ifr=document.getElementById("ifrFloat").contentWindow;
                            ifr.GetImg.call(ifr);
                            break;
                        //指令发送后的车机回应处理，格式：{SimID:SIM卡号,ResultMsg:消息,Time:时间,SignalType:指令类型}
                        default:
                            var ifr=document.getElementById("ifrCMessage").contentWindow;
                            ifr.AddCMsg.call(ifr,data,"FromMachine"); 
                            //显示所有即时消息，并给予流水提示                
                            $("#tbIM").val("["+GetVehNoF(data.SimID)+"]"+data.ResultMsg);  
                            SpotText();
                            break;
                    }
                }
            }catch(e){}
        }
        strs=null;
        if(DataString)
            setTimeout(function(){ProcessEveryJson()},150);
        else
            IsProcessing=false;
    }
    
    //发送当前用户所有下属车辆的系统编号，格式：|no|no|...|
    var allsysno;
    var ic=0;
    function SendAllSys(ClientID)
    {  
        xmls.send("{\"ClientID\":\""+ClientID+"\",\"AllSystemNos\":\""+allsysno.substr(ic,50)+"\",\"SysLength\":\""+allsysno.length+"\"}");
        ic+=50;
        if(ic<allsysno.length)
            setTimeout(function(){SendAllSys(ClientID)},100);
        else
            setTimeout(function(){xmls.send("{\"ClientID\":\""+ClientID+"\",\"AllSystemNos\":\"\",\"SysLength\":\""+allsysno.length+"\"}");},100);
    }
    
    //处理车机报警-------------------------------------------------------------------------------
    var msgAlarm=null;
    function AlarmProcess(msg)
    {
        msgAlarm=msg;                                              
        var ifr=document.getElementById("ifrContent").contentWindow;
        ifr.GetAddress.call(ifr,msg.Longitude,msg.Latitude,AddAlarmMsg); 
    } 
    //获取到报警地址后的回调
    function AddAlarmMsg(response)
    {
        if(response&&response.Status.code==200)
        {
            var place = response.Placemark[0];
            msgAlarm.AlarmLocation=place.address;
            var ifr=document.getElementById("ifrAlarm").contentWindow;
            ifr.AddAlarmMsg.call(ifr,msgAlarm); 
            //报警消息框
            if(document.getElementById("divAlarm").style.display=="none")                                                      
                StartPrompt('tdAlarm',1);
            else
                StopPrompt('tdAlarm',1);
        }
    }
    
    //指令下发-----------------------------------------------------------------------------------------
    //下发需要验证认证密码的指令
    function SendSignalSp()
    {
        var SystemNo=GetSystemNos();
        var ifr=document.getElementById("ifrFloat");
        var obj=ifr.contentWindow.document.getElementById("tbAuthPwd");
        var SignalType=document.getElementById("hdSignalType").value;
        var args=document.getElementById("hdArguments").value;
        if(obj.value==VehicleMonitor.GetAuthPwd(SystemNo).value)
        {
            obj.value="";
            SendSignal(SignalType,args);
            CloseWindow();
            return true;
        }
        else
        {
            alert('<%=this.GetLocalResource("AuthPwdWrong")%>');
            return false;
        }
    }
    
    //执行指令下发
    function SendSignal(SignalType,args,SimID)
    {
        var ClientID=$("#hdClientID").val();
        var nos=(SimID==undefined?GetSystemNos().split(','):SimID.split(','));
        var val=$("#hdCSystemNo").val();
        if(val!="")
            nos=new Array(val);
        if(nos[0]=="")
        {
            alert('<%=this.GetLocalResource("SelectVehicle")%>');
            return;
        }
        if(SignalType=="80#81")
        {    
            SignalType=args.split('#')[0];
            args=args.split('#')[1];
        }
        for(var i=0;i<nos.length;i++)
        {
            var signal="{\"ClientID\":\""+ClientID+"\",\"SignalName\":\""+SignalType+"\",\"SimID\":\""+nos[i]+"\",\"Arguments\":\""+args+"\"}";
            if(connected)
            {
                setTimeout(function(){xmls.send(signal);},100);
                var ifr=document.getElementById("ifrCMessage").contentWindow;
                var msg="";
                switch(SignalType.toString())
                {
                    case "60":
                        msg='<%=this.GetLocalResource("NameSent")%>';
                        break;
                    case "61":
                        msg='<%=this.GetLocalResource("GetStatusSent")%>';
                        break;
                    case "63":
                        msg=(args=="0"?'<%=this.GetLocalResource("ResetOilSent")%>':'<%=this.GetLocalResource("CutOilSent")%>');
                        break;
                    case "64":
                        msg='<%=this.GetLocalResource("IntervalSent")%>';
                        break;
                    case "65":
                        msg='<%=this.GetLocalResource("MessageSent")%>'+args+"";
                        break;
                    case "66":
                        msg='<%=this.GetLocalResource("GetVessionSent")%>';
                        break;
                    case "67":
                        msg='<%=this.GetLocalResource("VoiceMonitorSent")%>';
                        break;
                    case "68":
                        msg='<%=this.GetLocalResource("StopSpanSent")%>';
                        break;
                    case "69":
                        msg='<%=this.GetLocalResource("OverSpeedSent")%>';
                        break;
                    case "6A":
                        msg='<%=this.GetLocalResource("ResetSent")%>';
                        break;
                    case "6B":
                        msg='<%=this.GetLocalResource("OilArgSent")%>';
                        break;
                    case "6C":
                        msg=(args.split(',')[0]=="TakePhoto"?'<%=this.GetLocalResource("PhotoSent")%>':'<%=this.GetLocalResource("PhotoResetSent")%>');
                        break;
                    case "6D":
                        msg='<%=this.GetLocalResource("TiredSent")%>';
                        break;
                    case "6F":
                        msg='<%=this.GetLocalResource("TerminalSwitchSent")%>';
                        break;
                    case "70":
                        msg='<%=this.GetLocalResource("MileResetSent")%>';
                        UpdateMileArgs(nos[i],args);                         
                        break;
                    case "71":
                        msg='<%=this.GetLocalResource("AlarmCancelSent")%>';
                        break;
                    case "72":
                        msg='<%=this.GetLocalResource("MsgNoSent")%>';
                        break;
                    case "73":
                        msg='<%=this.GetLocalResource("ElectricScheduleSent")%>';
                        break;
                    case "7F":
                        msg='<%=this.GetLocalResource("TimeZoneSend")%>';
                        break;
                    case "80":
                        msg='<%=this.GetLocalResource("AutoPtSend")%>';
                        break;
                    case "81":
                        msg='<%=this.GetLocalResource("AutoPtCancel")%>';
                        break;
                    case "84":
                        msg='<%=this.GetLocalResource("LedControlSent")%>';
                        break;
                    case "85":
                        msg='<%=this.GetLocalResource("TemperatureSettingSent")%>';
                        break;
                    default:
                        break;
                }
                //显示所有即时消息，并给予流水提示                
                $("#tbIM").val("["+GetVehNoF(nos[i])+"]"+msg); 
                SpotText();
                var msg="{\"SimID\":\""+nos[i]+"\",\"Time\":\""+VehicleMonitor.GetTime().value+"\",\"ResultMsg\":\""+msg+"\"}";
                msg=eval("("+msg+")");
                ifr.AddCMsg.call(ifr,msg,"FromUser");                                                                                                                                
            }
        }
    }
    
    function UpdateMileArgs(SystemNo,MileVal)
    {
        var ifr=document.getElementById("ifrContent").contentWindow;
        ifr.UpdateFromMile.call(ifr,MileVal);        
        var aMile=document.getElementById("aMile"+SystemNo);
        if(aMile)
            aMile.title=MileVal;
    }
    
    //辅助函数---------------------------------------------------------
    //获取要执行指令的车辆的系统编号
    function GetSystemNos(GetAll)
    {
        //获取所有车辆的系统编号
        if(GetAll)
            return document.getElementById("hdVehJson").value.split('|')[0];
        
        //获取选中车辆的系统编号
        var hdList=document.getElementById("hdList"); 
        var inpts=document.getElementById(hdList.value=="0"?"tvVehicleList":"dgvVehicles").getElementsByTagName("input");
        var SystemNos="";
        for(var i=0;i<inpts.length;i++)
        {
            if(inpts[i].type=="checkbox"&&inpts[i].checked)
            {
                if(SystemNos!="")
                    SystemNos+=",";
                SystemNos+=inpts[i].title;
            }
        }
        if(!SystemNos)
            SystemNos=$("#hdCSystemNo").val();
        return SystemNos;
    }  
    
    //根据系统编号获取车牌号码
    var nofs=null;
    var snos=null;
    function GetVehNoF(SystemNo)
    {
        if(nofs==null)
        {
            var vals=document.getElementById("hdVehJson").value.split('|');
            snos=vals[0].split(',');
            nofs=vals[1].split(',');
        }
        for(var i=0;i<snos.length;i++)
        {
            if(snos[i]==SystemNo)
                return nofs[i];
        }
        return "";
    }                                                          
    
    
    //即时消息闪烁
    var spot=0;
    function SpotText()
    {
        spot=0;
        var intv=setInterval(function(){  
            var obj=document.getElementById("tbIM");
            if(spot>=5)
            {    
                clearInterval(intv);
                obj.style.fontWeight="normal";
                return;          
            }
            obj.style.fontWeight=(obj.style.fontWeight=="normal"?"bold":"normal");
            spot++;
        },300);
    }
    
    var embedMsg=document.getElementById("embedMsg");
    var embedAlarm=document.getElementById("embedAlarm");
    //停止图标闪烁和声音提示
    var interval1;
    var interval2;    
    function StopPrompt(id,inter)
    {
        var imgs=document.getElementById(id).getElementsByTagName("img");
        imgs[0].style.display="";
        imgs[1].style.display="none";
        
        if(inter=="1")
        {    
            clearInterval(interval1);
            interval1=null;
            embedAlarm.stop();
        }
        else
        {
            clearInterval(interval2);
            interval2=null;
            embedMsg.stop();
        }
    }
    //开始图标闪烁和声音提示
    var hdTone=document.getElementById("hdTone");
    function StartPrompt(id,intv)
    {
        if(intv=="1")
        {
            if(interval1==null)
                interval1=setInterval("PromptDisp('"+id+"')",300);
            if(hdTone.value=="1")
                embedAlarm.play();
        }
        else
        {   
            if(interval2==null) 
                interval2=setInterval("PromptDisp('"+id+"')",300);
            embedMsg.play();
        }
    }
    //执行闪烁
    function PromptDisp(id)
    {
        var imgs=document.getElementById(id).getElementsByTagName("img");
        imgs[0].style.display=imgs[0].style.display==""?"none":"";
        imgs[1].style.display=imgs[1].style.display==""?"none":"";
    }
    //绘制区域---------------------------------------------------------

      function SaveWF()
      {
        var ifr=document.getElementById("ifrFloat");
        ifr.src="NetUI/SaveArea.aspx";           
        document.getElementById("divDisable").style.display="";
        var divIfrm=document.getElementById("divIfrm");
        divIfrm.style.width="300px";
        divIfrm.style.left=($(window).width()-300)/2+"px";
        divIfrm.style.top="80px";
        divIfrm.style.display="";
        document.getElementById("tdTitle").innerHTML='<%=this.GetLocalResource("SaveArea") %>';
      }
      //POI定义---------------------------------------------------------
      function SavePoint()
      {
        var ifr=document.getElementById("ifrFloat");
        ifr.src="NetUI/SavePoint.aspx";           
        document.getElementById("divDisable").style.display="";
        var divIfrm=document.getElementById("divIfrm");
        divIfrm.style.width="340px";
        divIfrm.style.left=($(window).width()-300)/2+"px";
        divIfrm.style.top="80px";
        divIfrm.style.display="";
        document.getElementById("tdTitle").innerHTML='<%=this.GetLocalResource("SavePoint") %>';
      }
      function ShowPoint(marker)
      {
        var ifr=document.getElementById("ifrContent").contentWindow;
        ifr.ShowPoi.call(ifr,marker); 
      }
    </script>

    </form>
</body>
</html>
